package com.lz.bank.dao.impl;

import com.lz.bank.bean.Account;
import com.lz.bank.dao.AccountDao;
import com.lz.bank.utils.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class AccountDaoImpl implements AccountDao {


    @Override
    public int insertByActno(Account account) {
        return 0;
    }

    @Override
    public int deleteByActno(String actno) {
        return 0;
    }

    @Override
    public int updateByActno(Account account) {
        SqlSession sqlSession = SqlSessionUtil.openSession();
        System.out.println(sqlSession);
        int count = sqlSession.update("com.lz.bank.dao.AccountDao.updateByActno",account);
        //sqlSession.commit();
        //sqlSession.close();
        return count;
    }

    @Override
    public Account selectOneByActno(String actno) {
        SqlSession sqlSession = SqlSessionUtil.openSession();
        System.out.println(sqlSession);
        Account account = sqlSession.selectOne("com.lz.bank.dao.AccountDao.selectOneByActno", actno);
        return account;
    }

    @Override
    public List<Account> selectAll() {
        return null;
    }
}
